Skip to content

feat(diagnosticts): add option to show the source of the entry#3376

Open
Koliras wants to merge 3 commits intonvim-telescope:masterfrom
Koliras:master
Open

feat(diagnosticts): add option to show the source of the entry#3376
Koliras wants to merge 3 commits intonvim-telescope:masterfrom
Koliras:master

Conversation

@Koliras
Copy link

@Koliras Koliras commented Dec 5, 2024

Description

Adds option to show LSP source to diagnostics picker.
It's useful when you work on a multilanguage project.

Fixes #2544
Fixes #2110

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • :lua require('telescope.builtin').diagnostics({ show_source = true })

In the end of every result there should be the source that created the entry

Configuration:

  • Neovim version (nvim --version): v0.10.2
  • Operating system and version: Ubuntu 24.04.1 LTS

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

@Koliras Koliras marked this pull request as ready for review December 6, 2024 10:40
@deibit
Copy link

deibit commented Mar 27, 2025

Any updates on this? It is a very desirable feature to know the source of the diagnostic. Thanks.

@fdev31
Copy link

fdev31 commented Apr 4, 2025

Looks like it's a quite demanded feature, is there something wrong with this PR? It's super simple and provides the feature, it can always be improved later, having it is better than not...

@a-alak
Copy link

a-alak commented Jul 12, 2025

I could really use this - any idea of when/if it is going to be enabled?
Otherwise any workarounds I could implement today?

@flaszlo2000
Copy link

flaszlo2000 commented Aug 18, 2025

Workaround that I have found:
In lua/telescope/builtin/__diagnostics.lua, you could change this:
text = vim.trim(diagnostic.message:gsub("[\n]", ""))
to this
text = string.format("[%s] %s", diagnostic.source, vim.trim(diagnostic.message:gsub("[\n]", "")))

which adds the diagnostic source to the start of the diagnostic message. There might be some issues with line_width but this is just a temporary fix that anyone could implement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to show source in diagnostic picker Show LSP source with diagnostics picker

5 participants